home *** CD-ROM | disk | FTP | other *** search
/ Macromedia Multimedia Showcase 6.0 / Macromedia Multimedia Showcase v6.0 WIN-MAC (XMSH60CD)(Macromedia, Inc.)(1996).iso / pc / demosoft / xres / data.z / ERRORD.PS < prev    next >
Text File  |  1996-03-29  |  6KB  |  187 lines

  1.  
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. %%                                                                  %%
  4. %% errodict.ps: define the standard error handlers.                 %%
  5. %%                                                                  %%
  6. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7.  
  8. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. %%                                    %%
  10. %% `Backstop' errors allow you to prevent the default error handler %%
  11. %% from being over-ridden by downloaded error handlers.  This can   %%
  12. %% save film for typesetter output, and can be critically important %%
  13. %% to avoid deadly embraces if for example you get a VMerror during %%
  14. %% device setup.  The following list is representative.             %%
  15. %%                                    %%
  16. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  17.  
  18. errordict begin
  19.  
  20. /backstoperrors [
  21.   /VMerror /interrupt /timeout /ioerror /configurationerror
  22. ] def
  23.  
  24. end
  25.  
  26.  
  27. systemdict begin
  28.  
  29. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  30. %%                                    %%
  31. %% This is the default error action as described in section 3.10 of %%
  32. %% the Red Book.                            %%
  33. %%                                    %%
  34. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  35.  
  36. /.error {
  37.   currentglobal 3 1 roll
  38.   false setglobal
  39.   $error exch /errorname exch put
  40.   $error exch /command exch put
  41.   $error /newerror true put
  42.   $error /recordstacks get {
  43.     count array astore
  44.     $error exch /ostack exch put
  45.     $error /dstack countdictstack array dictstack put
  46.     $error /estack countexecstack array execstack dup length 2 sub 0
  47.       exch getinterval put
  48.     $error /ostack get aload pop
  49.   } if
  50.   setglobal
  51.   stop
  52. } binddef
  53.  
  54.  
  55. $error /recordstacks true put
  56. $error /binary false put
  57. $error /newerror false put
  58. $error /errorinfo null put
  59.  
  60. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  61. %%                                    %%
  62. %% This is needed at the end of unencapsulated jobs that call       %%
  63. %% executive, to remove the last reference to stdin.  Because TPro  %%
  64. %% uses a reference counted memory, stdin would not get close       %%
  65. %% otherwise.                                %%
  66. %%                                    %%
  67. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  68.  
  69. /clearerrorstacks {
  70.   $error /ostack null put
  71.   $error /dstack null put
  72.   $error /estack null put
  73.   $error /newerror false put
  74. } binddef
  75.  
  76. end    % systemdict
  77.  
  78.  
  79. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  80. %%                                    %%
  81. %% And to print the error messages:                    %%
  82. %%                                    %%
  83. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  84.  
  85. errordict begin
  86.  
  87. /handleerror {
  88.   $error begin
  89.   newerror {
  90.     binary currentobjectformat 0 ne and {
  91.       /Error errorname /command load
  92.         dup type /filetype eq {pop /--file--} if
  93.       false
  94.       printerrorobject
  95.     } {
  96.       /newerror false def
  97.       (%%[ Error: ) print
  98.       errorname dup type /stringtype ne { 256 string cvs } if print
  99.       (; OffendingCommand: ) print
  100.       errorname /undefined eq /command load
  101.       dup /get eq 1 index /get load eq or
  102.       1 index /load eq or exch /load load eq or
  103.       and {
  104.         (/) print ostack dup length 2 sub get
  105.     dup type dup /nametype eq {
  106.           pop dup length string cvs
  107.         } {
  108.           /stringtype ne {256 string cvs} if
  109.         } ifelse
  110.         print ( ) print
  111.       } if 
  112.       /command load dup type dup /nametype eq {
  113.         pop dup length string cvs
  114.       } {
  115.         /stringtype ne { 256 string cvs } if
  116.       } ifelse
  117.       print
  118.       ( ]%%\n) print
  119.       errorinfo null ne {
  120.         errorname /ioerror eq {
  121.           (%%[ File: )
  122.         } {
  123.           errorname /configurationerror eq {
  124.             (%%[ Request: )
  125.           } {
  126.             (%%[ Key: )
  127.           } ifelse
  128.         } ifelse
  129.         print
  130.         errorinfo 0 get dup type /stringtype ne {256 string cvs} if print
  131.         errorname /ioerror eq {(; Reason: )} {
  132.           errorname /undefinedresource eq {(; Category: )} {(; Value: )} ifelse
  133.         } ifelse
  134.         print
  135.         errorinfo 1 get dup type /stringtype ne {256 string cvs} if print
  136.         /errorinfo null def
  137.         ( ]%%\n) print
  138.       } if
  139.     } ifelse
  140.     flush
  141.   } if
  142.   end
  143. } binddef
  144.  
  145. /errorbackstop /handleerror load def
  146.  
  147. systemdict /handleerror /handleerror load put
  148.  
  149. /undefined {/undefined .error} def
  150. /configurationerror {/configurationerror .error} def
  151. /dictstackoverflow {/dictstackoverflow .error} def
  152. /dictstackunderflow {/dictstackunderflow .error} def
  153. /execstackoverflow {/execstackoverflow .error} def
  154. /interrupt {/interrupt .error} def
  155. /invalidaccess {/invalidaccess .error} def
  156. /invalidexit {/invalidexit .error} def
  157. /invalidfileaccess {/invalidfileaccess .error} def
  158. /invalidfont {/invalidfont .error} def
  159. /invalidrestore {/invalidrestore .error} def
  160. /ioerror {/ioerror .error} def
  161. /limitcheck {/limitcheck .error} def
  162. /nocurrentpoint {/nocurrentpoint .error} def
  163. /printererror {/printererror .error} def
  164. /rangecheck {/rangecheck .error} def
  165. /stackoverflow {/stackoverflow .error} def
  166. /stackunderflow {/stackunderflow .error} def
  167. /syntaxerror {/syntaxerror .error} def
  168. /timeout {/timeout .error} def
  169. /typecheck {/typecheck .error} def
  170. /undefinedfilename {/undefinedfilename .error} def
  171. /undefinedresource {/undefinedresource .error} def
  172. /undefinedresult {/undefinedresult .error} def
  173. /unimplemented {/unimplemented .error} def
  174. /unregistered {/unregistered .error} def
  175. /unmatchedmark {/unmatchedmark .error} def
  176. /VMerror {
  177.   $error /errorname /VMerror put
  178.   $error exch /command exch put
  179.   $error /newerror true put
  180.   stop
  181. } binddef
  182. /userdeferror1 {/userdeferror1 .error} def
  183. /userdeferror2 {/userdeferror2 .error} def
  184.  
  185. end    % errordict
  186.  
  187.